package com.monitor.controller;

import com.monitor.commons.SkJsonResult;
import com.monitor.commons.YXDate;
import com.monitor.dto.WechatAccountDTO;
import com.monitor.dto.WechatAccountPageDTO;
import com.monitor.modelExt.WechatAccountExt;
import com.monitor.pubInter.IBaseService;
import com.monitor.pubInter.exception.SkException;
import com.monitor.searchExt.WechatAccountSearchExt;
import com.monitor.service.IWechatAccountService;
import com.monitor.vo.WechatAccountDetailDomainVO;
import com.monitor.vo.WechatAccountDetailVO;
import com.monitor.vo.WechatAccountDomainVO;
import com.monitor.vo.WechatAccountListVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RequestMapping("/wechatAccount/")
@RestController(value = "wechatAccountController")
@Slf4j
public class WechatAccountController extends ApiManageController<WechatAccountDTO, WechatAccountPageDTO, WechatAccountExt, WechatAccountSearchExt, WechatAccountDomainVO, WechatAccountDetailDomainVO, WechatAccountDetailVO, WechatAccountListVO, String>{
    @Autowired
    private IWechatAccountService wechatAccountService;
    @Override
    public IBaseService<WechatAccountExt, WechatAccountSearchExt, String> getBaseService() throws SkException {
        return wechatAccountService;
    }

    /**
     * 公司所有使用者的微信账号数量
     * @return
     * @throws Exception
     */
    @PostMapping("queryCompanyAccountData")
    public SkJsonResult queryCompanyAccountData() throws Exception {
        wechatAccountService.syncWechatAccountData(YXDate.addDay(-1));

        return SkJsonResult.ok();
    }
}
